package com.example.widgetcase.slice;

import com.example.widgetcase.ResourceTable;
import com.example.widgetcase.slice.colorfilter.ColorMainAbility;
import com.example.widgetcase.slice.taperchart.ScrollTaperChartAbility;
import com.example.widgetcase.slice.taperchart.TaperChartAbility;
import com.example.widgetcase.slice.touch.RefreshViewAbility;
import com.example.widgetcase.slice.viewpager.ViewPagerTransformerAbilitySlice;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class MainAbilitySlice extends AbilitySlice implements Component.ClickedListener {

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_main_menu);
        initListeners();
    }

    private void initListeners() {
        Text t1 = (Text) findComponentById(ResourceTable.Id_selPtoBarTv);
        Text t2 = (Text) findComponentById(ResourceTable.Id_horTv);
        Text t3 = (Text) findComponentById(ResourceTable.Id_tv3);
        Text t4 = (Text) findComponentById(ResourceTable.Id_loadLine);
        Text t5 = (Text) findComponentById(ResourceTable.Id_halfCircleProView);
        Text t6 = (Text) findComponentById(ResourceTable.Id_shadowpro);
        Text t7 = (Text) findComponentById(ResourceTable.Id_imgTxtmixTure);
        Text t8 = (Text) findComponentById(ResourceTable.Id_matrixView);
        Text t9 = (Text) findComponentById(ResourceTable.Id_waveTv);
        Text t10 = (Text) findComponentById(ResourceTable.Id_gradientProBar);
        Text t11 = (Text) findComponentById(ResourceTable.Id_circleBtn);
        Text t12 = (Text) findComponentById(ResourceTable.Id_taperChartTv);
        Text t13 = (Text) findComponentById(ResourceTable.Id_HorTaperChartTv);
        Text t14 = (Text) findComponentById(ResourceTable.Id_timeRulerTv);
        Text t21 = (Text) findComponentById(ResourceTable.Id_imgOverturnTv);
        Text t22 = (Text) findComponentById(ResourceTable.Id_vpTransTv);
        Text t31 = (Text) findComponentById(ResourceTable.Id_circleProgressBarTv);
        Text t32 = (Text) findComponentById(ResourceTable.Id_colorMainTv);
        Text t33 = (Text) findComponentById(ResourceTable.Id_hssvTv);
        Text t34 = (Text) findComponentById(ResourceTable.Id_ringView);
        Text t35 = (Text) findComponentById(ResourceTable.Id_legend_ringView);
        Text t36 = (Text) findComponentById(ResourceTable.Id_ctmSvTv);
        Text t41 = (Text) findComponentById(ResourceTable.Id_refreshViewTv);
        t1.setClickedListener(this);
        t2.setClickedListener(this);
        t3.setClickedListener(this);
        t4.setClickedListener(this);
        t5.setClickedListener(this);
        t6.setClickedListener(this);
        t7.setClickedListener(this);
        t8.setClickedListener(this);
        t9.setClickedListener(this);
        t10.setClickedListener(this);
        t11.setClickedListener(this);
        t12.setClickedListener(this);
        t13.setClickedListener(this);
        t14.setClickedListener(this);
        t21.setClickedListener(this);
        t22.setClickedListener(this);
        t31.setClickedListener(this);
        t32.setClickedListener(this);
        t33.setClickedListener(this);
        t34.setClickedListener(this);
        t35.setClickedListener(this);
        t36.setClickedListener(this);
        t41.setClickedListener(this);
    }

    @Override
    public void onClick(Component component) {
        click(component.getId());
    }

    private void click(int resId) {
        switch (resId) {
            case ResourceTable.Id_selPtoBarTv:
                present(new SectionProBarAblility(), new Intent().setParam("name", "SectionProBar"));
                break;
            case ResourceTable.Id_horTv:
                present(new HorProBarAbility(), new Intent().setParam("name", "HorProBar"));
                break;
            case ResourceTable.Id_tv3:
                present(new GradientLineAbility(), new Intent().setParam("name", "GradientLine"));
                break;
            case ResourceTable.Id_loadLine:
                present(new LoadingLineViewAblility(), new Intent().setParam("name", "LoadingLineView"));
                break;
            case ResourceTable.Id_ringView:
                present(new RingViewAbilitySlice(), new Intent().setParam("name", "RingViewAbilitySlice"));
                break;
            case ResourceTable.Id_legend_ringView:
                present(new LegendRingViewAblilitySlice(), new Intent().setParam("name", "LegendRingViewAblilitySlice"));
                break;
            case ResourceTable.Id_halfCircleProView:
                present(new HalfCircleProViewAbility(), new Intent().setParam("name", "HalfCircleProView"));
                break;
            case ResourceTable.Id_shadowpro:
                present(new ShadowProBarAblility(), new Intent().setParam("name", "shadowprobar"));
                break;
            case ResourceTable.Id_gradientProBar:
                present(new GradientProBarAbility(), new Intent().setParam("name", "GradientProBar"));
                break;
            case ResourceTable.Id_imgTxtmixTure:
                present(new ImgTxtMixtureAblility(), new Intent().setParam("name", "imgtxtmixture"));
                break;
            case ResourceTable.Id_matrixView:
                present(new MatrixViewAblility(), new Intent().setParam("name", "matrixview"));
                break;
            case ResourceTable.Id_waveTv:
                present(new CircleWaveViewAbility(), new Intent().setParam("name", "WaveView"));
                break;
            case ResourceTable.Id_timeRulerTv:
                present(new TimeRulerAbility(), new Intent().setParam("name", "TimeRulerView"));
                break;
            case ResourceTable.Id_circleBtn:
                present(new CircleBtnAbtivity(), new Intent().setParam("name", "circlebtn"));
                break;
            case ResourceTable.Id_taperChartTv:
                present(new TaperChartAbility(), new Intent().setParam("name", "TaperChart"));
                break;
            case ResourceTable.Id_imgOverturnTv:
                present(new BmpOverturnAbilitySlice(), new Intent().setParam("name", "图片翻转动画"));
                break;
            case ResourceTable.Id_vpTransTv:
                present(new ViewPagerTransformerAbilitySlice(), new Intent().setParam("name", "ViewPagerTransformer"));
                break;
            case ResourceTable.Id_HorTaperChartTv:
                present(new ScrollTaperChartAbility(), new Intent().setParam("name", "HorTaperChart"));
                break;
            case ResourceTable.Id_circleProgressBarTv:
                present(new CircleProgressBarAbility(), new Intent().setParam("name", "CircleProgressBarView"));
                break;
            case ResourceTable.Id_colorMainTv:
                present(new ColorMainAbility(), new Intent().setParam("name", "图片滤镜"));
                break;
            case ResourceTable.Id_hssvTv:
                present(new HorScrollSelecteViewAbility(), new Intent().setParam("name", "HorScrollSelecteView"));
                break;
            case ResourceTable.Id_ctmSvTv:
                present(new CustomScrollViewAbility(), new Intent().setParam("name", "CustomScrollView"));
                break;
            case ResourceTable.Id_refreshViewTv:
                present(new RefreshViewAbility(), new Intent().setParam("name", "RefreshView"));
                break;
        }
    }
}
